home *** CD-ROM | disk | FTP | other *** search
/ CDV Software Presents (USA) / CDV Software Presents (USA).bin / demo / bk_demo.exe / DATA.PAK / maps / vitebsk.lua < prev   
Encoding:
Text File  |  2003-01-22  |  15.7 KB  |  560 lines

  1. -- GLOBALS DESCRIPTION
  2. -- 0 - unused objective
  3. -- 1-14 - objectives
  4. -- 100 - check var for last (tank) reinforcement
  5. -- 101 - check var for reinforcement to be given after JS-2 and infantry destroyed
  6. -- 102 - chack var for scout presence (1 - present)
  7. -- 103 - check var for sniper state
  8. -- 104 - check var for tank swap reinf state
  9. -- 105 - check var for tank swap state
  10. -- 106 - check var for "Karl ammo" objective
  11. -- 107 - check var for tank swap reinf #3 arrived state
  12. -- END OF DESCRIPTION
  13. -- Written by Udot
  14.  
  15. -- infantry attacks
  16. function Attack10()
  17. local A_Swarm = 3;
  18.     Cmd(A_Swarm, 10, 2000, 900);
  19.     Suicide();
  20. end;
  21.  
  22. -- JS-2 no.1 attacks
  23. function Attack11()
  24. local A_Swarm = 3;
  25.     Cmd(A_Swarm, 11, 1850, 3600);
  26.     QCmd(A_Swarm, 11, 1850, 900);
  27.     Suicide();
  28. end;
  29.  
  30. -- JS-2 no.2 attacks
  31. function Attack12()
  32. local A_Swarm = 3;
  33.     Cmd(A_Swarm, 12, 2300, 3600);
  34.     QCmd(A_Swarm, 12, 2300, 900);
  35.     Suicide();
  36. end;
  37.  
  38. -- JS-2 no.3 attacks
  39. function Attack13()
  40. local A_Swarm = 3;
  41.     Cmd(A_Swarm, 13, 2000, 3600);
  42.     QCmd(A_Swarm, 13, 2000, 900);
  43.     Suicide();
  44. end;
  45.  
  46. -- scout
  47. function PA3BEDKA1()
  48. local A_Scout = 21;
  49.     EnableAviation(1, 0);
  50.     Cmd(A_Scout, 10000, 1, 1900, 1500, 1700, 2000);
  51.     SetIGlobalVar("temp.gameplay.objective.102", 1); -- check scout appeared
  52.     RunScript("LandScoutInit", 115000);
  53.     Suicide();
  54. end;
  55.  
  56. -- scout
  57. function PA3BEDKA()
  58. local A_Scout = 21;
  59.     if (GetIGlobalVar("temp.gameplay.objective.4", 0) == 0) then -- check if scout is destroyed ++
  60.         Cmd(A_Scout, 10000, 1, 1900, 1500, 1700, 2000);
  61.         SetIGlobalVar("temp.gameplay.objective.102", 1); -- check scout appeared
  62.     end;
  63. end;
  64.  
  65. -- scout land initiator / first land
  66. function LandScoutInit()
  67.     SetIGlobalVar("temp.gameplay.objective.102", 0); -- check scout landed
  68.     if (GetIGlobalVar("temp.gameplay.objective.4", 0) == 0) then -- check if scout is destroyed
  69.         RunScript("LandScout", 220000);
  70.     end;
  71.     Suicide();
  72. end;
  73.  
  74. -- scout land test
  75. function LandScout()
  76.     SetIGlobalVar("temp.gameplay.objective.102", 0); -- check scout landed
  77.     if (GetIGlobalVar("temp.gameplay.objective.4", 0) == 1) then -- check if scout is destroyed
  78.         Suicide();
  79.     end;
  80. end;
  81.  
  82. -- JS-2 and enemy infantry destroyed -> sniper and Karl gun reinforcement -> Karl must survive
  83. function Reinforcement1()
  84.     if ((GetIGlobalVar("temp.gameplay.objective.1", 0) * GetIGlobalVar("temp.gameplay.objective.2", 0)) == 1) then
  85.         LandReinforcement(1); -- squad, Pz IV, Karl gun arrived
  86.         LandReinforcement(5); -- sniper #1 arrived
  87.         RunScript( "CheckReinf1", 3000);
  88.  
  89.         RunScript("RevealObj10", 5000);
  90.         RunScript("RevealObj4", 10000);
  91.         Suicide();
  92.     end;
  93. end;
  94.  
  95. function CheckReinf1()
  96.     SetIGlobalVar("temp.gameplay.objective.103", 1); -- check sniper #1 arrived
  97.     SetIGlobalVar("temp.gameplay.objective.101", 1); -- check reinforcement
  98.     Suicide();
  99. end;
  100.  
  101. function RevealObj10() -- now 5
  102.     if ( GetIGlobalVar( "temp.gameplay.objective.5", 0) == 0) then
  103.         ObjectiveChanged(5, 0); -- reveal objective "Karl must survive" ++
  104.     end;
  105.     Suicide();
  106. end;
  107.  
  108. function RevealObj4() -- now 6
  109.     if ( GetIGlobalVar( "temp.gameplay.objective.6", 0) == 0) then
  110.         ObjectiveChanged(6, 0); -- reveal objective "sneak into enemy rear area" ++
  111.     end;
  112.     Suicide();
  113. end;
  114.  
  115. -- our reinforcement at station & enemy tank group arrived
  116. function Reinforcement2()
  117. local A_Move = 0;
  118. local A_Rotate = 8;
  119. local A_Ambush = 14;
  120.  
  121.     if (GetIGlobalVar("temp.gameplay.objective.12", 0) == 1) then --++
  122.  
  123.     RunScript("Poezd", 100);
  124.     RunScript("SubReinf1", 1000);
  125.     RunScript("SubReinf2", 4000);
  126.     RunScript("SubReinf3", 7000);
  127.  
  128.     LandReinforcement(3); -- enemy troops arrived
  129. --    SetIGlobalVar("temp.gameplay.objective.100", 1); -- check reinforcement
  130.     Suicide();
  131.     end;
  132. end;
  133.  
  134. function Poezd()
  135.     if ( GetNUnitsInArea(0, "PoezdArea") <= 0) then
  136.         LandReinforcement(13);
  137.         Suicide();
  138.     end;
  139. end;
  140.  
  141. function SubReinf1()
  142.     LandReinforcement(10); -- our troops arrived #1
  143. --    Cmd(0, 1100, 940, 6740);
  144.     Suicide();
  145. end;
  146.  
  147. function SubReinf2()
  148.     LandReinforcement(11); -- our troops arrived #1
  149. --    Cmd(0, 1101, 620, 6740);
  150.     Suicide();
  151. end;
  152.  
  153. function SubReinf3()
  154.     LandReinforcement(12); -- our troops arrived #1
  155. --    Cmd(0, 1102, 220, 6740);
  156.     SetIGlobalVar("temp.gameplay.objective.100", 1); -- check reinforcement (the last)
  157.     Suicide();
  158. end;
  159.  
  160. function BlinkFighter()
  161.     if ( GetAviationState( 0) == 1) then
  162.         Suicide();
  163.     else
  164.         AskClient("HighlightControl(20031)");
  165.     end;
  166. end;
  167.  
  168. function BlinkBomber()
  169.     if ( GetAviationState( 0) == 3) then
  170.         Suicide();
  171.     else
  172.         AskClient("HighlightControl(20030)");
  173.     end;
  174. end;
  175.  
  176. -- infantry killed / enemy have captured platz
  177. function Objective1()
  178.     if (GetNUnitsInScriptGroup(10) <= 0) then
  179.         SetIGlobalVar("temp.gameplay.objective.1", 1);
  180.         ObjectiveChanged(1, 1);
  181.         RunScript("Objective2reveal", 6000);
  182.         RunScript("GiveTanks", 3000);
  183.  
  184.         RunScript("PA3BEDKA1", 1000);
  185.         RunScript("PA3BEDKA", 220000);
  186.         RunScript("Objective3reveal", 37000);
  187.  
  188.         Suicide();
  189.     end;
  190.     if (GetNScriptUnitsInArea(10, "Platz") > 0) then
  191.         SetIGlobalVar("temp.gameplay.objective.1", 2);
  192.         ObjectiveChanged(1, 2);
  193.         Suicide();
  194.     end;
  195. end;
  196.  
  197. -- all JS-2 killed
  198. function Objective2()
  199. local num = GetNUnitsInScriptGroup(11) + GetNUnitsInScriptGroup(12) + GetNUnitsInScriptGroup(13);
  200.     if (num <= 0) then
  201.         SetIGlobalVar("temp.gameplay.objective.2", 1);
  202.         ObjectiveChanged(2, 1);
  203.         Suicide();
  204.     end;
  205. end;
  206.  
  207. -- scout destroyed
  208. function Objective3() -- now 4
  209. local ID_Scout = 10000;
  210.     if (GetIGlobalVar("temp.gameplay.objective.102", 0) == 1) then -- check if scout appeared
  211.     if (GetNUnitsInScriptGroup(ID_Scout) <= 0) then
  212.         SetIGlobalVar("temp.gameplay.objective.4", 1); --+
  213.         ObjectiveChanged(4, 1); --+
  214.         DisableAviation(1, 0);
  215.  
  216.         KillScript( "BlinkFighter" );
  217.         Suicide();
  218.     end;
  219.     end;
  220. end;
  221.  
  222. -- sniper have sneaked in the rear area
  223. function Objective4() -- now 6
  224. local snipID = 1002;
  225.     if (GetIGlobalVar("temp.gameplay.objective.101", 0) == 1) then -- check if reinforcement arrived
  226.     if (GetIGlobalVar("temp.gameplay.objective.103", 0) == 3) then
  227.         snipID = 1020;
  228.     end;
  229.     if (GetNScriptUnitsInArea(snipID, "Sniper") > 0) then
  230.         SetIGlobalVar("temp.gameplay.objective.6", 1); --++
  231.         ObjectiveChanged(6, 1); --++
  232.         RunScript("RevealObj5", 5000);
  233.         Suicide();
  234.     end;
  235.     end;
  236. end;
  237.  
  238. -- reveal objective "destroy aaguns"
  239. function RevealObj5() -- now 8
  240.     if ( GetIGlobalVar( "temp.gameplay.objective.8", 0) == 0) then
  241.         ObjectiveChanged(8, 0); --++
  242.     end;
  243.     Suicide();
  244. end;
  245.  
  246. -- sniper must survive / give another sniper if killed
  247. function Objective13() -- now 7
  248.     if (GetIGlobalVar("temp.gameplay.objective.8", 0) == 0) then --++
  249.         if (GetIGlobalVar("temp.gameplay.objective.103", 0) == 1) then -- sniper #1 arrived last
  250.         if (GetNUnitsInScriptGroup(1002) <= 0) then -- sniper #1 killed
  251.             ObjectiveChanged(7, 0); -- remind with objective "sniper must survive"++
  252.             RunScript("GiveSniper", 7000); -- sniper #2 arrived
  253.             SetIGlobalVar("temp.gameplay.objective.103", 2); -- check sniper #2 arrived
  254.         end;
  255.         else
  256.         if (GetIGlobalVar("temp.gameplay.objective.103", 0) == 3) then -- sniper #2 arrived last
  257.         if (GetNUnitsInScriptGroup(1020) <= 0) then -- sniper #2 killed
  258.             ObjectiveChanged(7, 0); -- remind with objective "sniper must survive"++
  259.             SetIGlobalVar("temp.gameplay.objective.103", 2);
  260.             RunScript("GiveSniper", 7000); -- sniper #2 arrived once again
  261.               end;
  262.         end;
  263.         end;
  264.     else
  265.         Suicide();
  266.     end;
  267. end;
  268.  
  269. function GiveSniper()
  270.     LandReinforcement(4);
  271.     SetIGlobalVar("temp.gameplay.objective.103", 3);
  272.     Suicide();
  273. end;
  274.  
  275. -- 1003 #1 reinf tank, 1000 startup tank, 1010 #2 reinf tank, 1011 #3 reinf tank
  276. function Objective12() -- now 3
  277.     if (GetIGlobalVar("temp.gameplay.objective.12", 0) == 0) then -- check if "clear station" objective complete++
  278.         if (GetIGlobalVar("temp.gameplay.objective.104", 0) == 1) then -- tank reinf #2 arrived last
  279.             local total_tanks = GetNUnitsInScriptGroup(1010); -- default tank reinf is #2
  280.             if (GetIGlobalVar("temp.gameplay.objective.101", 0) == 1) then -- reinforcement #1 arrived
  281.                 total_tanks = total_tanks + GetNUnitsInScriptGroup(1003);
  282.             end;
  283.             if (GetIGlobalVar("temp.gameplay.objective.107", 0) == 1) then -- reinforcement #3 arrived
  284.                 total_tanks = total_tanks + GetNUnitsInScriptGroup(1011); -- now we can add number of units from group 1011
  285.             end;
  286.             if (total_tanks <= 0) then
  287.                 RunScript("GiveTanks", 15000);
  288.                 SetIGlobalVar("temp.gameplay.objective.104", 0); -- tanks are on a way
  289.                 ObjectiveChanged(3, 2); --+
  290.             end;
  291.         end;
  292.     else
  293.         Suicide();
  294.     end;
  295. end;
  296.  
  297. function GiveTanks()
  298. local A_Swarm = 3;
  299.     if (GetIGlobalVar("temp.gameplay.objective.105", 0) == 0) then -- #2 tanks
  300.         LandReinforcement(6); -- #2 tank reinf arrived
  301.         SetIGlobalVar("temp.gameplay.objective.105", 1); -- check #2 tank reinf arrived
  302.     else -- #3 tanks
  303.         LandReinforcement(7); -- #3 tank reinf arrived
  304.         SetIGlobalVar("temp.gameplay.objective.105", 0); -- check #3 tank reinf arrived
  305.         SetIGlobalVar("temp.gameplay.objective.107", 1); -- #3 arrived!!!!! needed for tank sequence
  306.     end;
  307.     SetIGlobalVar("temp.gameplay.objective.104", 1);
  308.     Suicide();
  309. end;
  310.  
  311. function Objective14() -- now 11
  312.     if (GetIGlobalVar("temp.gameplay.objective.101", 0) == 1) then
  313.     if (GetNUnitsInScriptGroup(1001) > 0) then
  314.     if (GetIGlobalVar("temp.gameplay.objective.106", 0) == 0) then
  315.         if (GetNAmmo(1001) <= 0) then
  316.             ObjectiveChanged(11, 0); --+
  317.             SetIGlobalVar("temp.gameplay.objective.106", 1);
  318.         end;
  319.     else
  320.         if (GetNAmmo(1001) > 0) then
  321.             ObjectiveChanged(11, 1); --+
  322.             SetIGlobalVar("temp.gameplay.objective.106", 1);
  323.             Suicide();
  324.         end;
  325.     end;
  326.     end;
  327.     end;
  328. end;
  329.  
  330. -- aaguns destroyed
  331. function Objective5() -- now 8
  332.     if ( GetNUnitsInScriptGroup(2711, 1) <= 0) then
  333.         SetIGlobalVar("temp.gameplay.objective.8", 1); --+
  334.         ObjectiveChanged(8, 1); --+
  335.         RunScript("RevealObj6", 5000);
  336.         Suicide();
  337.     end;
  338. end;
  339.  
  340. -- reveal objective "destroy artillery"
  341. function RevealObj6() --now 9
  342.     if ( GetIGlobalVar( "temp.gameplay.objective.9", 0) == 0) then
  343.         ObjectiveChanged(9, 0); --+
  344.         SwitchWeather( 0);
  345.             SwitchWeatherAutomatic(0);
  346.         EnableAviation(0, 3);
  347.         RunScript( "BlinkBomber", 4000);
  348.     end;
  349.     Suicide();
  350. end;
  351.  
  352. -- artillery destroyed
  353. function Objective6() -- now 9
  354.     if ( GetNUnitsInScriptGroup(2712, 1) <= 0) then
  355.         SetIGlobalVar("temp.gameplay.objective.9", 1); --+
  356.         ObjectiveChanged(9, 1); --+
  357.         RunScript("RevealObj7", 5000);
  358.         SwitchWeatherAutomatic( 1);
  359.         Suicide();
  360.     end;
  361. end;
  362.  
  363. -- reveal objective "clear DOT"
  364. function RevealObj7() -- now 10
  365.     if ( GetIGlobalVar( "temp.gameplay.objective.10", 0) == 0) then
  366.         ObjectiveChanged(10, 0); --+
  367.         ViewZone("Pillbox", 1);
  368.     end;
  369.         Suicide();
  370. end;
  371.  
  372. -- dot cleared
  373. function Objective7() -- now 10
  374.     if (GetNUnitsInScriptGroup(300) <=0) then
  375.         SetIGlobalVar("temp.gameplay.objective.10", 1); --+
  376.         ObjectiveChanged(10, 1); --+
  377.         RunScript("RevealObj8", 5000);
  378.         ViewZone("Pillbox", 0);
  379.         Suicide();
  380.     end;
  381. end;
  382.  
  383. -- reveal objective "clear station"
  384. function RevealObj8() -- now 12
  385.     if ( GetIGlobalVar( "temp.gameplay.objective.12", 0) == 0) then
  386.         ObjectiveChanged(12, 0); --+
  387.     end;
  388.     Suicide();
  389. end;
  390.  
  391. -- station cleared
  392. function Objective8() -- now 12
  393.     if (GetNUnitsInScriptGroup(301) <=0) then
  394.         SetIGlobalVar("temp.gameplay.objective.12", 1); --+
  395.         ObjectiveChanged(12, 1); --+
  396.         RunScript("Reinforcement2", 10000);
  397.         RunScript("RevealObj9", 13000);
  398.         Suicide();
  399.     end;
  400. end;
  401.  
  402. -- reveal objective "destroy enemy tank group"
  403. function RevealObj9() -- now 13
  404.     if ( GetIGlobalVar( "temp.gameplay.objective.13", 0) == 0) then
  405.         ObjectiveChanged(13, 0); --+
  406.     end;
  407.     Suicide();
  408. end;
  409.  
  410. -- enemy tank group destroyed / our reinforcement destroyed
  411. function Objective9() -- now 13
  412.     if (GetIGlobalVar("temp.gameplay.objective.100", 0) == 1) then
  413.  
  414. local num = GetNUnitsInScriptGroup(21);
  415.  
  416.     if (num <= 0) then
  417.         SetIGlobalVar("temp.gameplay.objective.13", 1); --+
  418.         ObjectiveChanged(13, 1); --+
  419.         RunScript("ToWin", 10000);
  420.         Suicide();
  421.     end;
  422. local num_our_tank = GetNUnitsInScriptGroup(1100) + GetNUnitsInScriptGroup(1101) + GetNUnitsInScriptGroup(1102) + GetNUnitsInScriptGroup(1010) + GetNUnitsInScriptGroup(1011);
  423.     if (num_our_tank <= 0) then
  424.         SetIGlobalVar("temp.gameplay.objective.13", 2); --+
  425.         ObjectiveChanged(13, 2); --+
  426.         Suicide();
  427.     end;
  428.     end;
  429. end;
  430.  
  431. -- Karl gun destroyed
  432. function Objective10() -- now 5
  433.     if (GetIGlobalVar("temp.gameplay.objective.101", 0) == 1) then
  434.  
  435.     if (GetNUnitsInScriptGroup(1001) <= 0) then
  436.         SetIGlobalVar("temp.gameplay.objective.5", 2); --+
  437.         ObjectiveChanged(5, 2); --+
  438.  
  439.         if ((GetIGlobalVar("temp.gameplay.objective.9", 0) == 1) and -- if "clear DOT" objective revealed++
  440.         (GetIGlobalVar("temp.gameplay.objective.10", 0) == 0)) then -- and DOT is not cleared++
  441.             SetIGlobalVar("temp.gameplay.objective.10", 2); --++
  442.             ObjectiveChanged(10, 2); -- then objective "clear DOT" is failed  ++
  443.         end;
  444.         Suicide();
  445.     end;
  446.     end;
  447. end;
  448.  
  449. function GiveTrucksIfKilled()
  450. local num;
  451.     if ( GetIGlobalVar( "temp.31415926", 0) == 1) then
  452.         num = GetNUnitsInScriptGroup(778);
  453.     else
  454.         num = GetNUnitsInScriptGroup(777);
  455.     end;
  456.     if ( num <= 0) then
  457.         LandReinforcement(778);
  458.         SetIGlobalVar( "temp.31415926", 1);
  459.         Suicide();
  460.     end;
  461. end;
  462.  
  463. -- only when enemy tank group destroyed
  464. function ToWin()
  465.     if ((GetIGlobalVar("temp.gameplay.objective.13", 0) == 1) and ( GetIGlobalVar( "temp.lost", 0) == 0)) then --+
  466.         Win(0);
  467.         Suicide();
  468.     end;
  469. end;
  470.  
  471. function ToLoose()
  472.     if ((GetIGlobalVar("temp.gameplay.objective.13", 0) == 2) or -- our tank reinforcement destroyed++
  473.     (GetIGlobalVar("temp.gameplay.objective.5", 0) == 2) or -- Karl killed ++
  474.     (GetIGlobalVar("temp.gameplay.objective.1", 0) == 2) or ( GetNUnitsInParty(0) <= 0)) then -- enemy infantry have entered location
  475.         SetIGlobalVar( "temp.lost", 1);
  476.         Loose();
  477.         Suicide();
  478.     end;
  479. end;
  480.  
  481. function Objective01reveal()
  482. --    ObjectiveChanged(0, 0); -- reveal startup objectives
  483.     ObjectiveChanged(1, 0);
  484. --    LandReinforcement(2712);
  485.  
  486.     Suicide();
  487. end;
  488.  
  489. function Objective2reveal()
  490.     if (GetIGlobalVar("temp.gameplay.objective.2", 0) == 0) then
  491.         ObjectiveChanged(2, 0); -- reveal objective "kill JS-2"
  492.         Suicide();
  493.     end;
  494. end;
  495.  
  496. function Objective3reveal() -- now 4
  497.     if (GetIGlobalVar("temp.gameplay.objective.4", 0) == 0) then --+
  498.         ObjectiveChanged(4, 0); -- reveal objective "kill scout plane"++
  499.         RunScript( "ForceCallFighters", 140000);
  500.         RunScript( "BlinkFighter", 4000);
  501.         Suicide();
  502.     end;
  503. end;
  504.  
  505. function DisableAvia()
  506.     DisableAviation(0, 3);
  507.     DisableAviation(1, 0);
  508.     Suicide();
  509. end;
  510.  
  511. -- stpd objective
  512. function RevealObjective15()
  513.     ObjectiveChanged(15, 0);
  514.     Suicide();
  515. end;
  516.  
  517. function Objective0()
  518.     SetIGlobalVar("temp.gameplay.objective.0", 1);
  519.     ObjectiveChanged(0, 1);
  520.     Suicide();
  521. end;
  522.  
  523. function ForceCallFighters()
  524.     if ( ( GetNUnitsInScriptGroup(10000) > 0) and ( GetAviationState( 0) <= 0)) then
  525.         Cmd( 20, 10555, 0, 2000, 1500);
  526.         Suicide();
  527.     end;
  528. end;
  529.  
  530. function Init()
  531.     RunScript("Attack10", 26000);
  532.     RunScript("Attack11", 55000);
  533.     RunScript("Attack12", 58000);
  534.     RunScript("Attack13", 61000);
  535. --    RunScript("LandScout", 150000);
  536.     RunScript("Reinforcement1", 6000);
  537. --    RunScript("Reinforcement2", 10000);
  538.     RunScript("Objective01reveal", 5000);
  539.     RunScript( "DisableAvia", 0);
  540. --    RunScript("Objective0", 5000);
  541.     RunScript("Objective1", 2000);
  542. --    RunScript("Objective2reveal", 100000);
  543.     RunScript("Objective2", 2000);
  544.     RunScript("Objective3", 2000);
  545.     RunScript("Objective4", 2000);
  546.     RunScript("Objective5", 2000);
  547.     RunScript("Objective6", 2000);
  548.     RunScript("Objective7", 2000);
  549.     RunScript("Objective8", 2000);
  550.     RunScript("Objective9", 2000);
  551.     RunScript("Objective10", 2000);
  552.     RunScript("Objective12", 2000);
  553.     RunScript("Objective13", 2000);
  554.     RunScript("Objective14", 2000);
  555.     RunScript( "RevealObjective15", 1000);
  556. --    RunScript("ToWin", 10000);
  557.     RunScript("ToLoose", 4100);
  558.     RunScript( "GiveTrucksIfKilled", 6000);
  559. end;
  560.